﻿using UnityEngine;

class EventOffsetGrid {
	// === Public =====================================================================================================
	public static void Action() {
		var baseData = MapEditorBaseData.GetInstance;
		if (!baseData.HasCamera() || !baseData.HasGrid()) {
			return;
		}
		var cameraTransform = baseData.Camera.transform;
		var gridElement = baseData.Grid;
		var pos = new Vector3(cameraTransform.position.x, gridElement.ElementModel.Position.y, cameraTransform.position.z);
		gridElement.SetPosition(pos);
		gridElement.ElementView.renderer.material.mainTextureOffset = new Vector2(pos.x, pos.z);
	}
}